var express = require('express');
var router = express.Router();
const { addCollection, addBrowse,
    getAllFoods, getDetails, searchFoods } = require('../service/foodsService');



//获取所有菜谱

router.get('/getAllFoods', async function (req, res) {
    const data = await getAllFoods(req.query);
    res.send(data);
});


//获取菜谱详情

router.post('/getDetails', async function (req, res) {
    const data = await getDetails(req.body);
    res.send(data);
});

//搜索菜谱


router.post('/searchFoods', async function (req, res) {
    const data = await searchFoods(req.body);
    res.send(data);
});


//收藏菜谱
router.post('/addCollection', async function (req, res) {
    const data = await addCollection(req.body);
    res.send(data);

});



//新增浏览记录
router.post('/addBrowse', async function (req, res) {
    const data = await addBrowse(req.body);
    res.send(data);

});






module.exports = router;
